s = input()
words = {"lqb", "lbq", "blq", "bql", "qbl", "qlb"}
i = 0
cnt = 0
while i <= len(s) - 2:
    if s[i:i + 3] in words:
        cnt += 1
        i += 3
        continue
    i += 1
print(cnt)
